using System.Collections.Generic;
using GameServer.ShootingGame.RenderableClasses;
using GameServer.Common.DataStructures2;
using GameServer.ShootingGame.Physics.CollisionReactionClasses.Base;
namespace GameServer.ShootingGame.MapClasses
{



    //GamePlay will instantiate a new Map on map load and pass in the tileset and respective dimensions.
    public class Map
    {
        private string title;
        private double mapWidth;
        private double mapHeight;
        private Array2D<int> tileData;
        private List<TileObject> tileObjects;
        private double tileWidth;
        private double tileHeight;
        private GamePlayManager gamePlayManager;

        public Map(string title, GamePlayManager gamePlayManager, int numTilesHorizontal, int numTilesVertical, double tileWidth, double tileHeight, Array2D<int> tileData, TileSet tileSet)
        {
            this.title = title;
            this.gamePlayManager = gamePlayManager;
            this.mapWidth = numTilesHorizontal * tileWidth;
            this.mapHeight = numTilesVertical * tileHeight;
            this.tileWidth = tileWidth;
            this.tileHeight = tileHeight;
            this.tileData = tileData;
            
        }

        //Loads instantiations of the tiles from the TileSet into the tileObjects field.
		public void loadTileObjects(TileSet tileSet){
			int i;
			int n = tileSet.Count;
			TileObject tileObj;
            CollisionEffects wallCollisionEffects;
            tileObjects = new List<TileObject>(n);
			for(i = 0; i < n; i++) {
				tileObj = tileSet.GetTileObject(i);
				tileObjects.Add(tileObj);
			}
		}


        //Checks what tile(s) the game object is positioned on performs any custom reactions.
        public void setTileBlockEffects(GameObject gameObject)
        {
            double xUnit = gameObject.xPosition / tileWidth;
            double yUnit = gameObject.yPosition / tileHeight;
        }



        public string Title
        {
            get { return title; }
            set { title = value; }
        }

        public double MapWidth
        {
            get
            {
                return mapWidth;
            }
        }

        public double MapHeight
        {
            get
            {
                return mapHeight;
            }
        }

        public Array2D<int> TileData
        {
            get
            {
                return tileData;
            }
            set
            {
                tileData = value;
            }
        }

        public List<TileObject> TileObjects
        {
            get
            {
                return tileObjects;
            }
        }


    }
}
